<!doctype html>
<html >
<head>
    <meta charset="UTF-8">
    <title>微信支付</title>
</head>
<body>

<div id="myQrCode"></div>
<div id="orderId">${orderId}</div>
<div id="returnUrl">${returnUrl}</div>

<script src="https://cdn.bootcss.com/jquery/1.5.1/jquery.min.js"></script>
<script src="https://cdn.bootcss.com/jquery.qrcode/1.0/jquery.qrcode.min.js"></script>
<script>
    $("#myQrCode").qrcode({
        text : "${codeUrl}"
    });
    $(function () {
        setInterval(function () {
            console.log("查询支付状态");
            $.ajax({
                url : '/pay/queryByOrderId',
                data : {
                    'orderId' : $("#orderId").text()
                },
                success: function (result) {
                    if(result.platformStatus != null
                        && result.platformStatus==='SUCCESS'){
                        location.href=$("#returnUrl").text()
                    }
                },
                error : function (result) {
                    console.log(result)
                }
            })
        },2000)
    })
</script>
</body>
</html>